package com.eden.controller;


import com.eden.common.R;
import com.eden.dto.CommentParam;
import com.eden.service.CommentsService;
import com.eden.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("comments")
public class CommentsController {

    @Autowired
    private CommentsService commentsService;

    @Autowired
    private SysUserService sysUserService;

    @GetMapping("article/{id}")
    public R comments(@PathVariable("id") Long articleId){

        return commentsService.commentsByArticleId(articleId);

    }

    @PostMapping("create/change")
    public R comment(@RequestBody CommentParam commentParam){
        return commentsService.comment(commentParam);
    }

}

